#pragma once

#include "Util.h"
#include "umc_h264_dec.h"
#include "umc_video_decoder.h"
#include "umc_data_pointers_copy.h"
#include "CoshipH264Splitter.h"
#include "H264FrameReader.h"
#include "umc_h264_spl.h"
#include "umc_video_processing.h"

class IppH264Decoder
{
	friend class DecoderManager;
public:
	IppH264Decoder();
	~IppH264Decoder(void);

	int DecodeH264Data(const uint8_t *data, uint32_t dataLen, 
						uint8_t *yuvBuf, uint32_t yuvBufSize, 
						bool &getFrame);

	int GetDecodedVideoSize(uint32_t &width, uint32_t &height) const;

private:
	bool                    m_initFlag;
	uint32_t                m_decWidth;
	uint32_t                m_decHeight;

	H264FrameReader         m_frameReader;
	CoshipH264Splitter      m_h264Splitter;
	UMC::MediaData          m_inputFrame;
	UMC::VideoData          m_outputFrame;
	UMC::H264VideoDecoder   m_decoder;
	UMC::VideoProcessing	m_videoProccessing; //UMC::DataPointersCopy   m_ptrCopy;

	bool InitDecoder();
	enum
	{
		BUFFER_SIZE = 262144
	};

	// The buffer for the media data
	uint8_t m_Buffer[BUFFER_SIZE];
	uint32_t  m_iDataSize;

	IppH264Decoder(const IppH264Decoder &);
	IppH264Decoder &operator=(const IppH264Decoder &);
};
